UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mz0QiE7wSWGIg9xZjpDAhE5tiP8uSljPFHqa2qVRKl8='
WHERE
key_id = '312b1580f4cebe3281beab2020d75db5ac3a246a14895742ee846c6443685bd4'
AND (
token = 'mz0QiE7wSWGIg9xZjpDAhE5tiP8uSljPFHqa2qVRKl8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)