UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hXVwbn0tJoo8hPMcZHkhMyhSoVO1jn+bZHI8EGB8cWY=' 
WHERE 
  key_id = '58cc84d30991cf1f48e618acb389b26992efacc844f743ee85e499cabe27cb6e' 
  AND (
    token = 'hXVwbn0tJoo8hPMcZHkhMyhSoVO1jn+bZHI8EGB8cWY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026