UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Aet5L66isXgsEykbMASYXs7X1Q1MENnjMnmDeFBqgHA='
WHERE
key_id = '5391e5193ac3c21417cb5e994d72cc107f52c4c548b359f1a5e2d63369ad7c60'
AND (
token = 'Aet5L66isXgsEykbMASYXs7X1Q1MENnjMnmDeFBqgHA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)