UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PI6EIL6A5TxGzgjE2A4+gH08gpS7+Kw9Bq4CqCQWjWM=' 
WHERE 
  key_id = '4ab6f8ce324daf1ea46c80e4284b15bcae9ee54e67d36dbcedffeb31ea87552e' 
  AND (
    token = 'PI6EIL6A5TxGzgjE2A4+gH08gpS7+Kw9Bq4CqCQWjWM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031