UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YyQyccdyxfvOnS2dcotuagDVIHUAxg8gchfUc+uQBCI='
WHERE
key_id = 'efdcbadc9257f3f83dc2c7a46e9060f5936248642a6b931d8d53ce1402352461'
AND (
token = 'YyQyccdyxfvOnS2dcotuagDVIHUAxg8gchfUc+uQBCI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)