UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T7rGhJnLGmfOJzdGmbdnpQxKgwTyBh5Sbe0t+h5bi6k=' 
WHERE 
  key_id = 'd81ce28b998790f28eac870a70fb5ccf0259a15d4e55c6f86b329f49f8da61c0' 
  AND (
    token = 'T7rGhJnLGmfOJzdGmbdnpQxKgwTyBh5Sbe0t+h5bi6k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049