UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'OgcLfuHJqkzol8ENaxHwzM/b+6s1Avo2n6fGXH1G+H8='
WHERE
key_id = '004f3a063d657e65d5c3fdf8f3e821e59642fc8872f835d056cd3e05b043b9bf'
AND (
token = 'OgcLfuHJqkzol8ENaxHwzM/b+6s1Avo2n6fGXH1G+H8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)