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