UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Jfj1imS43T4m3fKurWiBfB3E5trDhUT9ZmXi9JeGBZg='
WHERE
key_id = '8e382cda0e38f039c35c627fa4086882df1875ded23154d274399a610b37ae53'
AND (
token = 'Jfj1imS43T4m3fKurWiBfB3E5trDhUT9ZmXi9JeGBZg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)