UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RnLWHYsBHrTtBTsO+l2tokPWXJUBmtogiN+0y7aRJbk='
WHERE
key_id = 'd2d7473edd5247631d4e485e0c83a69d0d380057c3ca7b6258c200dc5d46419f'
AND (
token = 'RnLWHYsBHrTtBTsO+l2tokPWXJUBmtogiN+0y7aRJbk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)