UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3GB7Sa2owrWgbODba7LaaKmSZctw3rKJBudmcvazfDk=' 
WHERE 
  key_id = 'bee38afa93535710137de4767382e9ce7cfa1211f77caa56f5f623ef92b2b7d5' 
  AND (
    token = '3GB7Sa2owrWgbODba7LaaKmSZctw3rKJBudmcvazfDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022