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