UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hU/0DbAsYxRUjbS86MwBtOyD5L86Cso+/pyIDA9iWzs=' 
WHERE 
  key_id = '7746aa19b4d80284118233b874074771216e0138c05254ea0b8f4353438e06ad' 
  AND (
    token = 'hU/0DbAsYxRUjbS86MwBtOyD5L86Cso+/pyIDA9iWzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036