UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cIryZlo60cTW5UDmDTsHJj+4z6dCPc/P3YaM8DqTwUY='
WHERE
key_id = 'c17dbdb7fe3c3235a5d7afb5e61f374165b83e1be0c884d87f5f974af2946acd'
AND (
token = 'cIryZlo60cTW5UDmDTsHJj+4z6dCPc/P3YaM8DqTwUY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)