UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7kBwx5lH2oSew/gUQBl5C/DI49QGMQkfs65jkfgZeHk=' 
WHERE 
  key_id = 'e5f1b8e7ac75cdcf709854b85eca216132baf2fbab95ff3325912e7ba75ece9f' 
  AND (
    token = '7kBwx5lH2oSew/gUQBl5C/DI49QGMQkfs65jkfgZeHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052