UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sedMyyC3KmVuSu62xMzYgU46Qz5+wJJURYzmNv4S1JM='
WHERE
key_id = 'd9d1e63bd71e0ab2b12e7830026fa40379bd2fe4e401f4f8dcb377ff47b806d3'
AND (
token = 'sedMyyC3KmVuSu62xMzYgU46Qz5+wJJURYzmNv4S1JM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)