UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UsFLVtZ1JD+HoR6Tmi8WlHLR6fqLY1MAGTQNwH0UGxA=' 
WHERE 
  key_id = 'f6bd2e2d7f57a56f3f9540e7a0318f434191dd9feb5a8de1f350bc17cae3c4dc' 
  AND (
    token = 'UsFLVtZ1JD+HoR6Tmi8WlHLR6fqLY1MAGTQNwH0UGxA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029