UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D4T64HUc3exj/y58bU7wtnfefZ7wQsIR7CH8k30sdvw='
WHERE
key_id = '58cbc34eb5332b113cc642bfaa219b3bf147797322c28aaa9fffffb03abd3170'
AND (
token = 'D4T64HUc3exj/y58bU7wtnfefZ7wQsIR7CH8k30sdvw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)