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