UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I8nTPg5dizGukN+MmLdRdnG0VFYeD7c+EsbXnuFBteg='
WHERE
key_id = '5aa8c322584fd092c8f37d3feebe3efc3624b646011305ad0b73398a59d8d08e'
AND (
token = 'I8nTPg5dizGukN+MmLdRdnG0VFYeD7c+EsbXnuFBteg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)