UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ipgwsz155++4Tr+G7QjBW1VqOOp0slM8xfAkl3ZQec4='
WHERE
key_id = '31663e6ee1220514893670d18a78298f355989142627e983b84cbfcd9983be7c'
AND (
token = 'Ipgwsz155++4Tr+G7QjBW1VqOOp0slM8xfAkl3ZQec4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)