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