UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '132d9I8Z+jarFSeRHZelgaqBsUySBvVUo9S50A+K/dI=' 
WHERE 
  key_id = '499cfbffada1f151761ef2667ab313d00c8f34f50705e84c9f602697d619329f' 
  AND (
    token = '132d9I8Z+jarFSeRHZelgaqBsUySBvVUo9S50A+K/dI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023