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