UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LgDs+KlbiXKQs6GDFE3p4T6h0pYIzkgkD3fch8IJFvg='
WHERE
key_id = 'c8679221a67b10171a238aab02f1baf95ea1192c339fc3a3277bae1f0d7946ab'
AND (
token = 'LgDs+KlbiXKQs6GDFE3p4T6h0pYIzkgkD3fch8IJFvg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)