UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '99hQNz5nnz+L0i+mOqhqHxl5ijqsiLMm7NnUt4S10Ec=' 
WHERE 
  key_id = '15a99462793bef4239f5cbdc8f703fae214bd9ff71a3180bbb406e931d938553' 
  AND (
    token = '99hQNz5nnz+L0i+mOqhqHxl5ijqsiLMm7NnUt4S10Ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039