UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LHtWtVYk5QnTri9dCNUoAsrYRriaNjBfesRG+TWs+Bs=' 
WHERE 
  key_id = 'f78efc730caa1099f26ec1161158993bcb76623fe6dcef2c4350ceab7e22bc35' 
  AND (
    token = 'LHtWtVYk5QnTri9dCNUoAsrYRriaNjBfesRG+TWs+Bs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020