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