UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fgga+F0wzkiZVvhrhQaFXA5NtZizS5FLeywbWX+Fdgw=' 
WHERE 
  key_id = '9ad74623a46a87f8b3a0c40c83840a62215cffd99f704a09dbbb53583b7e35a6' 
  AND (
    token = 'fgga+F0wzkiZVvhrhQaFXA5NtZizS5FLeywbWX+Fdgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038