UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'coKcOAIauWYZ9bp7e9ewEydHm4ptS8hyCcBMv9wC11M='
WHERE
key_id = '57a72b6142f345200c1272b57baa104ce26feb327bf31853017958129f48a10a'
AND (
token = 'coKcOAIauWYZ9bp7e9ewEydHm4ptS8hyCcBMv9wC11M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)