UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4RIrXFsD2KIB0+3PohkE34EVAzgHrle8/TIOhQM+cr0='
WHERE
key_id = 'f518c85590edce8e66de7ee7669d9619039ed688f25bc0c19532dacd975028db'
AND (
token = '4RIrXFsD2KIB0+3PohkE34EVAzgHrle8/TIOhQM+cr0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)