UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xzX36jyxJUTnDxcpNzsVX16acJ3nMwedwyK7ka4n5x0='
WHERE
key_id = 'fb07098d7b3ee59c8503d1b5d4c726a12e2a3d155439861c37227d45b2a7437e'
AND (
token = 'xzX36jyxJUTnDxcpNzsVX16acJ3nMwedwyK7ka4n5x0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)